package com.example.hehecat.yuejian1.ui.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.hehecat.yuejian1.R;
import com.example.hehecat.yuejian1.mvp.model.api.Api;
import com.example.hehecat.yuejian1.mvp.model.bean.MasterBean;
import com.squareup.picasso.Picasso;

public class MasterListAdapter extends BaseQuickAdapter<MasterBean, BaseViewHolder> {
    private Context context;

    public MasterListAdapter(int layoutResId, Context context) {
        super(layoutResId);
        this.context = context;
    }


    @Override
    protected void convert(BaseViewHolder helper, MasterBean item) {
        String sex ;
       int sexflag = item.getMastersex();
       if (sexflag == 1){
           sex="男";
       }else{
           sex="女";
       }
            helper.setText(R.id.master_name,item.getMastername())
                    .setText(R.id.master_intro,item.getMasterintro())
                    .setText(R.id.master_list_sex,sex)
                    .setText(R.id.master_phone,item.getMasterphone());

            Picasso.with(context).load(Api.IMG_URL+item.getMasterpic()).into((ImageView) helper.getView(R.id.master_pic));
        }
    }

